/////////////////////////////////////////////////////////////////////////////
// Name:        MirrorlistPage.cpp
// Purpose:     
// Author:      yospaly
// Modified by: 
// Created:     05/01/2010 10:57:48
// RCS-ID:      
// Copyright:   Copyright (C) 2008, yospaly
// Licence:     
/////////////////////////////////////////////////////////////////////////////

// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif

////@begin includes
////@end includes

#include "MirrorlistPage.h"
#include "MirrorlistPanel.h"

////@begin XPM images
////@end XPM images


/*!
 * MirrorlistPage type definition
 */

IMPLEMENT_DYNAMIC_CLASS( MirrorlistPage, wxWizardPageSimple )


/*!
 * MirrorlistPage event table definition
 */

BEGIN_EVENT_TABLE( MirrorlistPage, wxWizardPageSimple )

////@begin MirrorlistPage event table entries
    EVT_WIZARD_PAGE_CHANGED( -1, MirrorlistPage::OnMirrorlistWizardpagePageChanged )

////@end MirrorlistPage event table entries

END_EVENT_TABLE()


/*!
 * MirrorlistPage constructors
 */

MirrorlistPage::MirrorlistPage()
{
    Init();
}

MirrorlistPage::MirrorlistPage( wxWizard* parent )
{
    Init();
    Create( parent );
}


/*!
 * MirrorlistPage creator
 */

bool MirrorlistPage::Create( wxWizard* parent )
{
////@begin MirrorlistPage creation
    wxBitmap wizardBitmap(wxNullBitmap);
    wxWizardPageSimple::Create( parent, NULL, NULL, wizardBitmap );

    CreateControls();
    if (GetSizer())
        GetSizer()->Fit(this);
////@end MirrorlistPage creation
    return true;
}


/*!
 * MirrorlistPage destructor
 */

MirrorlistPage::~MirrorlistPage()
{
////@begin MirrorlistPage destruction
////@end MirrorlistPage destruction
}


/*!
 * Member initialisation
 */

void MirrorlistPage::Init()
{
////@begin MirrorlistPage member initialisation
    p_mirrors_panel = NULL;
////@end MirrorlistPage member initialisation
}


/*!
 * Control creation for MirrorlistPage
 */

void MirrorlistPage::CreateControls()
{    
////@begin MirrorlistPage content construction
    MirrorlistPage* itemWizardPageSimple1 = this;

    wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
    itemWizardPageSimple1->SetSizer(itemBoxSizer2);

    wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
    itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW, 5);

    wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
    itemBoxSizer3->Add(itemBoxSizer4, 1, wxALIGN_CENTER_VERTICAL, 5);

    wxStaticText* itemStaticText5 = new wxStaticText( itemWizardPageSimple1, wxID_STATIC, _("Choose A Download Site"), wxDefaultPosition, wxDefaultSize, 0 );
    itemStaticText5->SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, false, wxT("Tahoma")));
    itemBoxSizer4->Add(itemStaticText5, 0, wxALIGN_LEFT|wxALL, 5);

    wxStaticText* itemStaticText6 = new wxStaticText( itemWizardPageSimple1, wxID_STATIC, _("Choose a site from this list, or input your own custom site"), wxDefaultPosition, wxDefaultSize, 0 );
    itemStaticText6->Wrap(350);
    itemBoxSizer4->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT, 20);

    wxStaticBitmap* itemStaticBitmap7 = new wxStaticBitmap( itemWizardPageSimple1, wxID_STATIC, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer3->Add(itemStaticBitmap7, 0, wxALIGN_CENTER_VERTICAL|wxALL, 20);

    wxStaticLine* itemStaticLine8 = new wxStaticLine( itemWizardPageSimple1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
    itemBoxSizer2->Add(itemStaticLine8, 0, wxGROW|wxALL, 5);

    p_mirrors_panel = new MirrorlistPanel( itemWizardPageSimple1, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
    itemBoxSizer2->Add(p_mirrors_panel, 1, wxGROW|wxALL, 5);

////@end MirrorlistPage content construction
}


/*!
 * Should we show tooltips?
 */

bool MirrorlistPage::ShowToolTips()
{
    return true;
}

/*!
 * Get bitmap resources
 */

wxBitmap MirrorlistPage::GetBitmapResource( const wxString& name )
{
    // Bitmap retrieval
////@begin MirrorlistPage bitmap retrieval
    wxUnusedVar(name);
    return wxNullBitmap;
////@end MirrorlistPage bitmap retrieval
}

/*!
 * Get icon resources
 */

wxIcon MirrorlistPage::GetIconResource( const wxString& name )
{
    // Icon retrieval
////@begin MirrorlistPage icon retrieval
    wxUnusedVar(name);
    return wxNullIcon;
////@end MirrorlistPage icon retrieval
}


/*!
 * wxEVT_WIZARD_PAGE_CHANGED event handler for ID_MIRRORLIST_WIZARDPAGE
 */

void MirrorlistPage::OnMirrorlistWizardpagePageChanged( wxWizardEvent& event )
{
    p_mirrors_panel->check_reload_tree();
}

